/**
 * @param {number[][]} tasks
 * @return {number[]}
 */
// 败了
 var getOrder = function(tasks) {
    const res = []
    let timer = tasks[0][0], p = tasks[0][1]
    count = 0
    while(count < tasks.length){
        let queue = []
        for(let i =0; i<tasks.length; i++){
            if(tasks[i][0] >= timer && tasks[i][0] <= timer+p)
                queue.push([i,...tasks[i]])
        }
        queue.sort((a,b) => a[2]-b[2])
        let t = queue.shift()
        timer = timer+t[2]
        p = t[2]
        res.push(t[0])
        count++
        timer++
    }
    return res
};